<template>
	<div class="upload" @click="click">
		<input type="file" ref='file' @change="changefile" style="display: none;" multiple="multiple"/>
		<slot></slot>
	</div>
</template>

<script>
	export default {
		data() {
			return {}
		},
		mounted() {},
		methods: {
			changefile(e) {
				console.log(e)
				const files = e.target.files;

				if(!files) {
					return;
				}
				this.$emit('click',files[0])
				this.$refs.file.value = null;

			},
			click(){
				this.$refs.file.click();
			}
		},
		computed: {}
	}
</script>

<style lang="scss" scoped>
	.upload {
		display: inline-block;
	}
</style>